package indi.woniu.service.impl;


import indi.woniu.entity.ExamAdministration;
import indi.woniu.mapper.ExamAdministrationDao;
import indi.woniu.service.ExamAdministrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 添加的单张试卷的基本信息(ExamAdministration表)服务实现类
 *
 * @author yangliang
 * @since 2021-12-14 11:49:24
 */
@Service
public class ExamAdministrationServiceImpl implements ExamAdministrationService {
    @Autowired(required=true)
    private ExamAdministrationDao examAdministrationDao;

    /**
     * 通过ID查询单条数据
     *
     * @param examId 主键
     * @return 实例对象
     */
    @Override
    public ExamAdministration selectById(Integer examId) {
        return this.examAdministrationDao.selectById(examId);
    }

    /**
     * 分页查询
     *
     * @param start 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<ExamAdministration> selectPage(int start, int limit) {
        return this.examAdministrationDao.selectPage(start, limit);
    }

    /**
     * 查询所有
     *分页可用
     * @return 实例对象的集合
     */
    @Override
    public List<ExamAdministration> selectAll() {
        return this.examAdministrationDao.selectAll();
    }

    /**
     * 根据条件查询
     *
     * @return 实例对象的集合
     */
    @Override
    public List<ExamAdministration> selectList(ExamAdministration examAdministration) {
        return this.examAdministrationDao.selectList(examAdministration);
    }

    /**
     * 新增数据
     *
     * @param examAdministration 实例对象
     * @return 实例对象
     */
    @Override
    public Integer insert(ExamAdministration examAdministration) {
        return this.examAdministrationDao.insert(examAdministration);
    }

    /**
     * 批量新增
     *
     * @param examAdministrations 实例对象的集合
     * @return 生效的条数
     */
    @Override
    public Integer batchInsert(List<ExamAdministration> examAdministrations) {
        return this.examAdministrationDao.batchInsert(examAdministrations);
    }

    /**
     * 修改数据
     *
     * @param examAdministration 实例对象
     * @return 实例对象
     */
    @Override
    public ExamAdministration update(ExamAdministration examAdministration) {
        this.examAdministrationDao.update(examAdministration);
        return this.selectById(examAdministration.getId());
    }

    @Override
    public ExamAdministration updateOne(ExamAdministration examAdministration) {
        this.examAdministrationDao.updateOne(examAdministration);
        return this.selectById(examAdministration.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param examId 主键
     * @return 是否成功
     */
    @Override
    public Integer deleteById(Integer examId) {
        return this.examAdministrationDao.deleteById(examId);
    }

    /**
     * 查询总数据数
     *
     * @return 数据总数
     */
    @Override
    public int count(){
        return this.examAdministrationDao.count();
    }

    @Override
    public List<ExamAdministration> selectAllTest(ExamAdministration examAdministration) {
        return this.examAdministrationDao.selectAllTest(examAdministration);
    }

    @Override
    public List<ExamAdministration> selectAllOne(ExamAdministration examAdministration) {
        return this.examAdministrationDao.selectAllOne(examAdministration);
    }
}
